Ternary 三元運算子


Posted by Rich on 2021-04-22

console.log(10 > 5 ? 'bigger' : 'smaller')
output:bigger

condition ? true : false
條件 ? true就執行 : false就執行


#note







Related Posts

Laravel 7 Blade Component

Laravel 7 Blade Component

react 用 axios 打 localhost api server 出現 ERR_NETWORK 錯誤

react 用 axios 打 localhost api server 出現 ERR_NETWORK 錯誤

Hold Shift to Check Multiple Checkboxes

Hold Shift to Check Multiple Checkboxes


Comments